 //
//  HNSalesManCycleDetailModel.m
//  优学荟管理系统
//
//  Created by edz on 2017/11/7.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "HNSalesManCycleDetailModel.h"

@implementation HNSalesManCycleDetailModel

// 实例化
- (instancetype)init_ValuForKeyWithDict:(NSDictionary *)Dict {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:Dict];
    }
    return self;
}

// KVO
- (void)setValue:(id)value forKey:(NSString *)key {
    
    if ([key isEqualToString:@"organizationInfoSects"]) {
        
        [value enumerateObjectsUsingBlock:^(NSDictionary * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            
            [self.orgs addObject:[[HNSalesManCycleDetailOrgModel alloc] init_ValuForKeyWithDict:obj]];
        }];
    } else if ([key isEqualToString:@"resourcePieDatas"]) {
        
        [value enumerateObjectsUsingBlock:^(NSDictionary * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
           
            [self.resourcePieDatas addObject:[[HNSalesManCycleDetailCycleModel alloc] init_ValuForKeyWithDict:obj]];
        }];
    } else if ([key isEqualToString:@"elementCategorys"]) {
      
        [value enumerateObjectsUsingBlock:^(NSDictionary * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
           
            [self.CategoryArr addObject:[[HNSalesManCycleDetailCatgoryModel alloc] init_ValuForKeyWithDict:obj]];
        }];
    } else if ([key isEqualToString:@"resources"]) {
        
        self.ResourcerModel = [[HNSalesManCycleDetailResourcerModel alloc] init_ValuForKeyWithDict:[value firstObject]];
    } else {
        
        [super setValue:value forKey:key];
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    

}


- (NSMutableArray<HNSalesManCycleDetailCycleModel *> *)resourcePieDatas {
    
    if (!_resourcePieDatas) {
        
        _resourcePieDatas = [NSMutableArray array];
    }
    return _resourcePieDatas;
}

- (NSMutableArray<HNSalesManCycleDetailOrgModel *> *)orgs {
    
    if (!_orgs) {
        
        _orgs = [NSMutableArray array];
    }
    return _orgs;
}

- (NSMutableArray<HNSalesManCycleDetailCatgoryModel *> *)CategoryArr {
    
    if (!_CategoryArr) {
        
        _CategoryArr = [NSMutableArray array];
    }
    return _CategoryArr;
}
@end
